#include <stack>
#include <iostream>
using namespace std;


int main() {
	int numberOfCouples;

	while(cin>>numberOfCouples && numberOfCouples) {
		int n = 2*numberOfCouples;
		stack<int> people;

		// assign an array to set the positions of the couples ..
		int* constructionArr = new int[n];

		// set the positions of the couples ..
		int posHusband, posWife;
		for(int i=0;i<numberOfCouples;++i) {
			cin >> posHusband >> posWife;
			constructionArr[posHusband-1] = i;
			constructionArr[posWife-1] = i;
		}

		// clear the people stack ..
		while(!people.empty()) {
			people.pop();
		}

		// loop reduce the pair ..
		for(int i=0;i<n;++i) {
			// check if people stack empty ..
			if(people.empty()) { // empty ..
				// push the corresponding people into the stack of people ..
				people.push(constructionArr[i]);
				continue;
			}
			else { // not empty ..
				// check if catch pair ..
				if(people.top() == constructionArr[i]) { // catched ..
					// reduce the pair ..
					people.pop();
					continue;
				}
				else { // not catch ..
					people.push(constructionArr[i]);
					continue;
				}
			}
		}

		// check the result ..
		if(people.size() == 0) { // all reduced ..
			cout << "Yes" << endl;
		}
		else { // failed to reduce ..
			cout << "No" << endl;
		}
		
		// release the resources of constructionArr ..
		delete constructionArr;
	}

	return 0;
}
